﻿Imports System.Data.OleDb
Public Class TechieProfile
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.Params("TechieName") = User.Identity.Name Then
            Btn_editProfile.Visible = True
        Else
            Btn_editProfile.Visible = False
        End If
        'Displaying the number of discussion made by current user 
        Dim DiscCountSql As String = "SELECT * FROM User_DiscCount WHERE Author=@f1"
        Dim sqldbconn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionStringList").ConnectionString)
        sqldbconn.Open()
        Dim cmdDisc As OleDbCommand = New OleDbCommand(DiscCountSql, sqldbconn)
        cmdDisc.Parameters.AddWithValue("@f1", User.Identity.Name)
        Dim Discdatareader = cmdDisc.ExecuteReader()
        Discdatareader.Read()
        If Not IsDBNull(Discdatareader("NmbrofDisc")) Then lbldiscussionsadded.Text = (Discdatareader("NmbrofDisc"))

        'Displaying the number of questions asked by current user
        Dim QuesCountSql As String = "SELECT * FROM User_DiscCount WHERE Author=@f1"
        Dim cmdQues As OleDbCommand = New OleDbCommand(QuesCountSql, sqldbconn)
        cmdQues.Parameters.AddWithValue("@f1", User.Identity.Name)
        Dim Quesdatareader = cmdQues.ExecuteReader()
        Quesdatareader.Read()
        If Not IsDBNull(Quesdatareader("NmbrofDisc")) Then lblpostsAdded.Text = (Quesdatareader("NmbrofDisc"))

        sqldbconn.Close()
    End Sub

   
End Class